import axios from "axios";
import { useEffect, useState } from "react";

const URL = "http://geek.itheima.net/v1_0/channels";
function App() {
  const [list, setlist] = useState([]);
  useEffect(() => {
    const getList = async () => {
      const res = await axios.get(URL);
      console.log(res);
      setlist(res.data.data.channels);
    };
    getList();
  });
  return (
    <>
      <div>跟组件</div>
      <ul>
        {list.map((v) => (
          <li key={v.id}>{v.name}</li>
        ))}
      </ul>
    </>
  );
}

export default App;
